//
//  StatusCellBottomView.swift
//  sinaweibo
//
//  Created by mac on 15/11/15.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {

    @objc private func retweetedBtnDidClick() {
        let temp = TempViewController()
        
        reweetedBtn.NavController()?.pushViewController(temp, animated: true)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    private func setupUI(){
        
        addSubview(reweetedBtn)
        addSubview(composeBtn)
        addSubview(likeBtn)
        
        let w:CGFloat = 1
        let scale:CGFloat = 0.4
        reweetedBtn.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(snp_top)
            make.left.equalTo(snp_left)
            make.height.equalTo(snp_height)
        }
        
        let sepView1 = sepView()
        addSubview(sepView1)
        sepView1.snp_makeConstraints { (make) -> Void in
            
            make.left.equalTo(reweetedBtn.snp_right)
            make.height.equalTo(reweetedBtn.snp_height).multipliedBy(scale)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(w)
        }
        
        composeBtn.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(snp_top)
            make.left.equalTo(reweetedBtn.snp_right)
            make.height.equalTo(snp_height)
            make.width.equalTo(reweetedBtn.snp_width)
        }
        
        let sepView2 = sepView()
        addSubview(sepView2)
        sepView2.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(self.snp_centerY)
            make.left.equalTo(composeBtn.snp_right)
            make.height.equalTo(reweetedBtn.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
        }
        
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.height.equalTo(snp_height)
            make.top.equalTo(snp_top)
            make.right.equalTo(snp_right)
            make.width.equalTo(composeBtn.snp_width)
        }
        
        //添加转发按钮的点击事件
        reweetedBtn.addTarget(self, action: "retweetedBtnDidClick", forControlEvents: .TouchUpInside)
        
    }
    
    //分割线
//    private lazy var sepView1:UIView = {
//        let v = UIView()
//        v.backgroundColor = UIColor.darkGrayColor()
//        return v
//    }()
    private func sepView() -> UIView {
        let v = UIView()
        v.backgroundColor = UIColor.darkGrayColor()
        return v
    }
    
    //转发按钮
    private lazy var reweetedBtn:UIButton = UIButton(title: "转发", image: "timeline_icon_retweet", backImage: nil, color: UIColor.lightGrayColor(), size: 10)
    //评论按钮
    private lazy var composeBtn:UIButton = UIButton(title: "评论", image: "timeline_icon_comment", backImage: nil, color: UIColor.lightGrayColor(), size: 10)
    //赞
    private lazy var likeBtn:UIButton = UIButton(title: "赞", image: "timeline_icon_unlike", backImage: nil, color: UIColor.lightGrayColor(), size: 10)
    
}
